<template>
	<div class="box">
		<!--v-if="list.length>0"-->
		<HomeFeaturedGoods :FeaturedGoodsData="arraydata" page="newPage"></HomeFeaturedGoods>
		<!--<div v-if="list.length==0 && env === 'edit'" style="height: 2.5rem;line-height: 2.5rem;">请配置数据</div>-->
	</div>
</template>

<script>
	import HomeFeaturedGoods from "../../../real-components/HomeFeaturedGoods";
	import { mapGetters } from "vuex";
	import { getPageTree, initDomTree } from "../../../utils/getPageTree";
	import axios from "axios";
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				msg: '这是首页',
				page: "home",
				componentName: "HomeFeaturedGoods",
				arraydata: []
			}
		},
		computed: {
			...mapGetters([
				"getDomTree"
			]),
			pageTree() {
				return getPageTree(this, this.page);
			},
			env() {
				return window.environment; // 获取是否是编辑状态
			},
		},
		components: {
			HomeFeaturedGoods,
		},
		methods: {
			fivedata() {
				let arraydata1 = []
				let length = this.list.length < 5 ? this.list.length : 5
				for(let i = 0; i < length; i++) {
				    arraydata1.push(this.list[i])
				}
				this.arraydata = arraydata1;
			}
		},
		created() {
		},
		watch:{
			list(list){
				this.fivedata()
			}
		},
		mounted() {
			this.fivedata()
			// initDomTree(this.getDomTree[this.page]);
			/*this.queryFeaturedRec()*/
		},
		updated() {
			//页面更新完毕
			// initDomTree(this.getDomTree[this.page]);
		}
	}
</script>

<style>

</style>